import requests from '@/utils/request'

// 获取角色列表
export const getRoleList = (params) => {
  return requests({
    url: '/sys/role',
    method: 'GET',
    params
  })
}
// 添加角色
export const addRole = (data) => {
  return requests({
    url: '/sys/role',
    method: 'POST',
    data
  })
}
// 编辑角色
export const editRow = (data) => {
  return requests({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}
// 删除角色
export const delRow = (id) => {
  return requests({
    url: `/sys/role/${id}`,
    method: 'DELETE'
  })
}

/**
 * 获取角色详情
 * **/

export function getRoleDetail(id) {
  return requests({
    url: `/sys/role/${id}`
  })
}

/**
 * 给角色分配权限
 *
 * ***/

export function assignPerm(data) {
  return requests({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
